package org.sucri.floxs.html;

import org.antlr.stringtemplate.StringTemplate;

import javax.persistence.Table;
import java.util.Map;
import java.util.HashMap;

/**
 * Created by IntelliJ IDEA.
 * User: Wen Yu
 * Date: Aug 26, 2007
 * Time: 10:28:54 AM
 * To change this template use File | Settings | File Templates.
 */
public class TestTemplateDictionary implements TemplateDictionary
{
  protected Map<String, String> mRepository = new HashMap<String, String>();

  public TestTemplateDictionary()
  {
    init();
  }
  public String getAttribute(String key)               { return mRepository.get(key); }
  public String setAttribute(String key, String value) { return mRepository.put(key, value); }

  public StringTemplate setAttributes(StringTemplate st)
  {
    for (String key : mRepository.keySet())
    {
      st.setAttribute(key, getAttribute(key));
    }
    return st;
  }

  protected void init()
  {
    String extjs =
        "<link rel='stylesheet' type='text/css' href='/sucri/js/extjs/resources/css/ext-all.css'/>\n" +
        "<!-- GC --> <!-- LIBS --><script type='text/javascript' src='/sucri/js/extjs/adapter/ext/ext-base.js'></script><!-- ENDLIBS -->\n" +
        "<script type='text/javascript' src='/sucri/js/extjs/ext-all.js'></script>\n" +
        "<script type='text/javascript' src='/sucri/js/fluxs/common.js'></script>\n" +
        "<script type='text/javascript' src='/sucri/js/write-store.js'></script>\n";

    String extjs_debug =
        "<link rel='stylesheet' type='text/css' href='/sucri/js/extjs/resources/css/ext-all.css'/>\n" +
        "<script type='text/javascript' src='/sucri/js/extjs/source/core/ext.js'></script>\n" +
        "<script type='text/javascript' src='/sucri/js/extjs/source/adapter/ext-base.js'></script>\n" +
        "<script type='text/javascript' src='/sucri/js/extjs/ext-all-debug.js'></script>\n" +
        "<script type='text/javascript' src='/sucri/js/fluxs/common.js'></script>\n" +
        "<script type='text/javascript' src='/sucri/js/write-store-src.js'></script>\n";       

    String dwrjs = "<script type='text/javascript' src='/sucri/js/engine.js'> </script>\n" +
                   "<script type='text/javascript' src='/sucri/js/dwrproxy.js'></script>\n" +
                   "<script type='text/javascript' src='/sucri/js/fluxs/dwrwriteproxy.js'></script>\n";

    String dwrproxyjs = "<script type='text/javascript' src='/sucri/dwr/interface/Admin.js'></script>\n";
    String formjs =
        "<link rel='stylesheet' type='text/css' href='/js/extjs/resources/css/xtheme-aero.css'/>\n" +
        "<link rel='stylesheet' type='text/css' href='/js/extjs/resources/css/form.css'/>\n";

    String adminjs =
        "<link rel='stylesheet' type='text/css' href='/css/fluxs/sucri_admin.css'/>\n" +
        "<link rel='stylesheet' type='text/css' href='/js/fluxs/sucri_admin.js'/>\n";

    String script_login    = "<script type='text/javascript' src='/js/fluxs/login_dlg.js'></script>";
    String script_register = "<script type='text/javascript' src='/js/fluxs/register.js'></script>";

    String login_container = "<div id='login-form'></div>";

    String menu_top =
        "    <ul class='leftmenu'>\n" +
        "\t\t<li class='Solutions'>$menu_top_1$</li>\n" +
        "\t\t<li><a href='#'>$menu_top_2$</a></li>\n" +
        "\t\t<li><a href='#'>$menu_top_3$</a></li>\n" +
        "\t\t<li><a href='#'>$menu_top_4$</a></li>\n" +
        "\t\t<li><a href='#'>$menu_top_5$</a></li>\n" +
        "\t\t<li class='clients'><a href='#'>$menu_top_6$</a></li>\n" +
        "\t</ul>";

    String menu_section =
        "\t\t<h2>$section_title$</h2>\n" +
        "\t\t<ul>\n" +
        "\t\t\t<li><a href='#'><span>$menu_section_1$</span></a></li>\n" +
        "\t\t\t<li><a href='#'><span>$menu_section_2$</span></a></li>\n" +
        "\t\t\t<li><a href='#'><span>$menu_section_3$</span></a></li>\n" +
        "\t\t\t<li><a href='#'><span>$menu_section_4$</span></a></li>\n" +
        "\t\t\t<li><a href='#'><span>$menu_section_5$</span></a></li>\n" +
        "\t\t\t<li><a href='#'><span>$menu_section_6$</span></a></li>\n" +
        "\t\t\t<li><a href='#'><span>$menu_section_7$</span></a></li>\n" +
        "\t\t</ul>";

    String news_form = "<div>\n" +
//        "    <div class='x-box-tl'><div class='x-box-tr'><div class='x-box-tc'></div></div></div>\n" +
//        "    <div class='x-box-ml'><div class='x-box-mr'><div class='x-box-mc'>\n" +
//        "        <h3 style='margin-bottom:5px;'>Multi-column and labels top</h3>\n" +
        "        <div id='id_news'> </div>\n" +
//        "    </div></div></div>\n" +
//        "    <div class='x-box-bl'><div class='x-box-br'><div class='x-box-bc'></div></div></div>\n" +
        "</div><script>Ext.onReady(Page.init_news_form, Page, true);</script>";

    setAttribute("script_proxy", dwrproxyjs);
    setAttribute("script_dwr", dwrjs);
    setAttribute("script_extjs", extjs_debug);
    setAttribute("script_formjs", formjs);
    setAttribute("script_adminjs", adminjs);
    setAttribute("title", "TITLE");
    setAttribute("login", "login.js");
    setAttribute("login_container", login_container);
    setAttribute("resource", "/sucri/css/aquatic/");
    setAttribute("menu_section", menu_section);
    setAttribute("script_login", script_login);
    setAttribute("script_register", script_register);
    setAttribute("script_news", "<script type='text/javascript' src='/sucri/js/fluxs/news_entry.js'></script>");
    setAttribute("news_form", news_form);
    setAttribute("theme_extjs", "default");
    setAttribute("images_extjs", "/sucri/css/images/fluxs/");
  }
}
